<template>
  <PageMain>
    <template #header></template>
    <template #body>
      <div
        class="resource-view-1-box w-full h-full overflow-hidden box-border flex justify-start items-center flex-col"
      >
        <div
          class="content w-full h-[calc(100%_-_64px)] box-border p-[20px_24px] overflow-hidden overflow-y-auto"
        >
          <div
            class="w-full h-[56px] p-[16px_0] overflow-hidden box-border flex justify-start items-start"
            style="font-family: Microsoft YaHei; font-size: 16px; font-weight: bold; color: #394d73"
          >
            基础信息
          </div>
          <div class="info w-full h-auto p-[20px] box-border bg-[#f7f9fc] rounded-[8px]">
            <a-row>
              <a-col :span="8">
                <div class="content">
                  <span class="icon">凭证编号 :</span>
                  <span class="text">{{ formInline.credential_code }}</span>
                </div>
              </a-col>
              <a-col :span="8">
                <div class="content">
                  <span class="icon">凭证名称 :</span>
                  <span class="text">{{ formInline.credential_name }}</span>
                </div>
              </a-col>
            </a-row>
          </div>
          <div
            class="w-full h-[56px] p-[16px_0] overflow-hidden box-border flex justify-start items-start"
            style="font-size: 16px; font-weight: bold; color: #394d73"
          >
            财务数据
          </div>
          <CommonTable
            :showPagination="false"
            :columnsData="showDetailTableData"
            :tableData="tableData"
          >
            <template #index="{ rowIndex }">
              <span>{{ rowIndex + 1 }}</span>
            </template>
          </CommonTable>
        </div>
      </div>
    </template>
  </PageMain>
</template>

<script lang="ts" setup>
import { ref, onMounted, reactive } from 'vue';
import { showDetailTableData } from './values';
import { getDetail } from '@/api/costManagement/voucher_management/index';
import { useRoute } from 'vue-router';

const route = useRoute();
// 表单数据
let formInline = reactive<any>({
  credential_code: '',
  credential_name: ''
});
const tableData = ref<any>([]);

/**
 * @method  checkDetail 获取详情
 */
const checkDetail = async () => {
  //调接口放开
  const res = await getDetail(route.query.id as string);
  if (res.code) {
    const data = res.data;
    formInline = data;
    // formInline.credential_code = res.data?.credential_code;
    // formInline.credential_name = res.data?.credential_name;
    tableData.value = data.cost_allocation;
  }
};
onMounted(() => {
  checkDetail();
});
</script>

<style lang="less" scoped>
.MainBox {
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
}
.TabPaneClass {
  padding: 0 30px;
}
.content {
  margin-bottom: 33px;
  font-size: 14px;
  font-family: MicrosoftYaHei;
  color: #465a80;

  .icon {
    color: #a3b0cc;
    font-family: Microsoft YaHei;
    font-size: 14px;
    font-weight: normal;
  }
  .text {
    padding-left: 16px;
    color: #465a80;
    font-family: Microsoft YaHei;
    font-size: 14px;
    font-weight: normal;
  }
}
.footer {
  border-top: 1px solid #ebf0fa;
  width: 100%;
  padding: 0 20px;
  display: flex;
  justify-content: flex-end;
  height: 50px;
  align-items: center;
}
.circle-point {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border-width: 2px;
}
</style>
